<?php

 
class Add_Resource_Form extends My_Form {
    
    function __construct($form_id, $resource_type_id) {
        My_Form::__construct($form_id);
        $this->DefaultValues = array(
                            'resource_name' => '',
                            'resource_identifier' => '',
                            'resource_hour_rent_price' => '',
                            'resource_note' => '',
                            'resource_type_id' => $resource_type_id);
       
        $this->init();
    }

    public function init() {
        $this->form->addDataSource(new HTML_QuickForm2_DataSource_Array($this->DefaultValues));
        $fieldset = $this->form->addElement('fieldset')->setLabel('Add Resource Information');
        $name = $fieldset->addElement('text', 'resource_name', array('size' => 50, 'maxlength' => 30))->setLabel('Name:');
        $identifier = $fieldset->addElement('text', 'resource_identifier', array('size' => 50, 'maxlength' => 30))->setLabel('Identifier:');
        $hour_rent_price = $fieldset->addElement('text', 'resource_hour_rent_price', array('size' => 50, 'maxlength' => 30))->setLabel('Hour Rent Price:');
        $note = $fieldset->addElement('textarea', 'resource_note', array('size' => 50, 'maxlength' => 255, 'cols' => 36, 'rows' => 7))->setLabel('Note:');
        $type_id = $fieldset->addElement('hidden', 'resource_type_id', array('size' => 70, 'maxlength' => 70))->setLabel('');
        
        $name->addFilter('trim')->addRule('required', 'Please enter the resource name');
        $identifier->addFilter('trim')->addRule('required', 'Please enter the resource identifier');
        $hour_rent_price->addFilter('trim')->addRule('required', 'Please enter the hour rent price');
        
        $fieldset->addElement('submit', null, array('value' => 'Submit'));
        $fieldset->addElement('button', 'cancelButton', array('onclick' => "window.location.href='index.php?action=resources'",  'type' => 'button'), array('content' => 'Cancel'));
        $this->form->addElement('hidden', 'action')->setValue('add_resource');
    }

}

?>



